[PATCH] Update sources to support OpenSSL 4
authorMårten Nordheim <marten.nordheim@qt.io>
Thu, 26 Mar 2026 14:45:13 +0000 (15:45 +0100)
committerPatrick Franz <deltaone@debian.org>
Sun, 9 Aug 2026 10:38:49 +0000 (12:38 +0200)
commit1d9ad0a15f2632b30c464639917f74887a816dfa
tree4a6fb688cf3e4fb2ed1c425a735a0a5d68bb8d92
parent4e12cf50dcc26ea58085438f6d06391bdac310ac
[PATCH] Update sources to support OpenSSL 4

OpenSSL 4 now uses const in logical cases across its X.509 API; this
patch updates Qt's TLS backend to compile against both 3.x and 4.x.

To do this QT_OPENSSL4_CONST macro (expands to `const` on OpenSSL >= 4,
empty otherwise) is introduced for functions which changed in OpenSSL 4.

There were pre-existing functions that were already const in OpenSSL 3
but were declared without const in Qt's wrapper layer - they have now
been fixed with plain const.

ASN1_STRING was made opaque in OpenSSL 4, so replace direct access with
use of accessor functions through the wrappers.

tst_qsslcertificate: add expected output for OpenSSL 4's slightly
different extension formatting.
tst_qsslsocket::ecdhServer: lock to TLS 1.2 as OpenSSL 4 no longer
exports DH/ECDH parameters for TLS 1.3 sessions.

Fixes: QTBUG-145221
Pick-to: 6.8
Change-Id: Ic3f7d3cf00dbcb5b4cd1a299d3608a7c694a3454
Reviewed-by: Mate Barany <mate.barany@qt.io>
Reviewed-by: Jonas Kvinge <jonas@jkvinge.net>
(cherry picked from commit e806630e694d89f567cffa9c982d1f471089ecd8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Gbp-Pq: Name upstream_openssl4.patch
src/plugins/tls/openssl/qopenssl_p.h
src/plugins/tls/openssl/qsslsocket_openssl_symbols.cpp
src/plugins/tls/openssl/qsslsocket_openssl_symbols_p.h
src/plugins/tls/openssl/qx509_openssl.cpp
src/plugins/tls/openssl/qx509_openssl_p.h
tests/auto/network/ssl/qsslcertificate/more-certificates/cert-large-expiration-date.txt.4.0.0 [new file with mode: 0644]
tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp
tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp
tests/auto/network/ssl/shared/qopenssl_symbols.h